﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using UIShare;
using EFong.View.Proxy;
using EFong.Contract;

namespace EFong.View.Report
{
    public partial class Frm_应付款报表 : BasicForm
    {
        private Proxy.ReportServiceProxy _reportProxy {get{ return Proxy.ReportServiceProxy.GetInstance();}}

        public Frm_应付款报表()
        {
            InitializeComponent();
        }

        protected override void InitFields()
        {
        }

        protected override void Events()
        {
            this.Load += (s, e) =>
            {
                List<应付款报表> list = _reportProxy.GetReport11().ReturnValue;

                bool sourceIsNull = list == null;
                bool sourceIsEmpty = !sourceIsNull && list.Count == 0;

                if (sourceIsEmpty)
                {
                    MsgBox.Info("没有找到符合条件的数据.");
                }

                this.grd_Report.DataSource = list;
            };
        }

        private void bar_Main_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            switch (e.Item.Name)
            {
                case "bbt_Export":
                    this.export();
                    break;
                case "bbt_Close":
                    this.Close();
                    break;
                default:
                    break;
            }
        }

        private void export()
        {
            FileExport.ExportToExcel(this.grd_Report, "应付款报表");
        }
    }
}
